---
page_title: "cloudflare_rulesets Data Source - Cloudflare"
subcategory: ""
description: |-
  Use this datasource to lookup Rulesets in an account or zone.
---

# cloudflare_rulesets (Data Source)

Use this datasource to lookup Rulesets in an account or zone.

## Example Usage

```terraform
data "cloudflare_rulesets" "example" {
  zone_id = "0da42c8d2132a9ddaf714f9e7c920711"

  filter {
    name = ".*OWASP.*"
  }
}
```
<!-- schema generated by tfplugindocs -->
## Schema

### Optional

- `account_id` (String) The account identifier to target for the resource. Must provide only one of `zone_id`, `account_id`.
- `filter` (Block List, Max: 1) (see [below for nested schema](#nestedblock--filter))
- `include_rules` (Boolean) Include rule data in response.
- `zone_id` (String) The zone identifier to target for the resource. Must provide only one of `zone_id`, `account_id`.

### Read-Only

- `id` (String) The ID of this resource.
- `rulesets` (List of Object) (see [below for nested schema](#nestedatt--rulesets))

<a id="nestedblock--filter"></a>
### Nested Schema for `filter`

Optional:

- `id` (String) The ID of the Ruleset to target.
- `kind` (String) Type of Ruleset to create. Available values: `custom`, `managed`, `root`, `zone`.
- `name` (String) Name of the ruleset.
- `phase` (String) Point in the request/response lifecycle where the ruleset will be created. Available values: `ddos_l4`, `ddos_l7`, `http_config_settings`, `http_custom_errors`, `http_log_custom_fields`, `http_ratelimit`, `http_request_cache_settings`, `http_request_dynamic_redirect`, `http_request_firewall_custom`, `http_request_firewall_managed`, `http_request_late_transform`, `http_request_origin`, `http_request_redirect`, `http_request_sanitize`, `http_request_sbfm`, `http_request_transform`, `http_response_compression`, `http_response_firewall_managed`, `http_response_headers_transform`, `magic_transit`.
- `version` (String) Version of the ruleset to filter on.


<a id="nestedatt--rulesets"></a>
### Nested Schema for `rulesets`

Read-Only:

- `description` (String)
- `id` (String)
- `kind` (String)
- `name` (String)
- `phase` (String)
- `rules` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules))
- `version` (String)

<a id="nestedobjatt--rulesets--rules"></a>
### Nested Schema for `rulesets.rules`

Read-Only:

- `action` (String)
- `action_parameters` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters))
- `description` (String)
- `enabled` (Boolean)
- `exposed_credential_check` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--exposed_credential_check))
- `expression` (String)
- `id` (String)
- `last_updated` (String)
- `logging` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--logging))
- `ratelimit` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--ratelimit))
- `ref` (String)
- `version` (String)

<a id="nestedobjatt--rulesets--rules--action_parameters"></a>
### Nested Schema for `rulesets.rules.action_parameters`

Read-Only:

- `additional_cacheable_ports` (Set of Number)
- `automatic_https_rewrites` (Boolean)
- `autominify` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--autominify))
- `bic` (Boolean)
- `browser_ttl` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--browser_ttl))
- `cache` (Boolean)
- `cache_key` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--cache_key))
- `content` (String)
- `content_type` (String)
- `cookie_fields` (Set of String)
- `disable_apps` (Boolean)
- `disable_railgun` (Boolean)
- `disable_zaraz` (Boolean)
- `edge_ttl` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--edge_ttl))
- `email_obfuscation` (Boolean)
- `from_list` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--from_list))
- `from_value` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--from_value))
- `headers` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--headers))
- `host_header` (String)
- `hotlink_protection` (Boolean)
- `id` (String)
- `increment` (Number)
- `matched_data` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--matched_data))
- `mirage` (Boolean)
- `opportunistic_encryption` (Boolean)
- `origin` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--origin))
- `origin_cache_control` (Boolean)
- `origin_error_page_passthru` (Boolean)
- `overrides` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--overrides))
- `phases` (Set of String)
- `polish` (String)
- `products` (Set of String)
- `read_timeout` (Number)
- `request_fields` (Set of String)
- `respect_strong_etags` (Boolean)
- `response` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--response))
- `response_fields` (Set of String)
- `rocket_loader` (Boolean)
- `rules` (Map of String)
- `ruleset` (String)
- `rulesets` (Set of String)
- `security_level` (String)
- `serve_stale` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--serve_stale))
- `server_side_excludes` (Boolean)
- `sni` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--sni))
- `ssl` (String)
- `status_code` (Number)
- `sxg` (Boolean)
- `uri` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--uri))
- `version` (String)

<a id="nestedobjatt--rulesets--rules--action_parameters--autominify"></a>
### Nested Schema for `rulesets.rules.action_parameters.version`

Read-Only:

- `css` (Boolean)
- `html` (Boolean)
- `js` (Boolean)


<a id="nestedobjatt--rulesets--rules--action_parameters--browser_ttl"></a>
### Nested Schema for `rulesets.rules.action_parameters.version`

Read-Only:

- `default` (Number)
- `mode` (String)


<a id="nestedobjatt--rulesets--rules--action_parameters--cache_key"></a>
### Nested Schema for `rulesets.rules.action_parameters.version`

Read-Only:

- `cache_by_device_type` (Boolean)
- `cache_deception_armor` (Boolean)
- `custom_key` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--version--custom_key))
- `ignore_query_strings_order` (Boolean)

<a id="nestedobjatt--rulesets--rules--action_parameters--version--custom_key"></a>
### Nested Schema for `rulesets.rules.action_parameters.version.custom_key`

Read-Only:

- `cookie` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--version--custom_key--cookie))
- `header` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--version--custom_key--header))
- `host` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--version--custom_key--host))
- `query_string` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--version--custom_key--query_string))
- `user` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--version--custom_key--user))

<a id="nestedobjatt--rulesets--rules--action_parameters--version--custom_key--cookie"></a>
### Nested Schema for `rulesets.rules.action_parameters.version.custom_key.user`

Read-Only:

- `check_presence` (List of String)
- `include` (List of String)


<a id="nestedobjatt--rulesets--rules--action_parameters--version--custom_key--header"></a>
### Nested Schema for `rulesets.rules.action_parameters.version.custom_key.user`

Read-Only:

- `check_presence` (List of String)
- `exclude_origin` (Boolean)
- `include` (List of String)


<a id="nestedobjatt--rulesets--rules--action_parameters--version--custom_key--host"></a>
### Nested Schema for `rulesets.rules.action_parameters.version.custom_key.user`

Read-Only:

- `resolved` (Boolean)


<a id="nestedobjatt--rulesets--rules--action_parameters--version--custom_key--query_string"></a>
### Nested Schema for `rulesets.rules.action_parameters.version.custom_key.user`

Read-Only:

- `exclude` (List of String)
- `include` (List of String)


<a id="nestedobjatt--rulesets--rules--action_parameters--version--custom_key--user"></a>
### Nested Schema for `rulesets.rules.action_parameters.version.custom_key.user`

Read-Only:

- `device_type` (Boolean)
- `geo` (Boolean)
- `lang` (Boolean)




<a id="nestedobjatt--rulesets--rules--action_parameters--edge_ttl"></a>
### Nested Schema for `rulesets.rules.action_parameters.version`

Read-Only:

- `default` (Number)
- `mode` (String)
- `status_code_ttl` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--version--status_code_ttl))

<a id="nestedobjatt--rulesets--rules--action_parameters--version--status_code_ttl"></a>
### Nested Schema for `rulesets.rules.action_parameters.version.status_code_ttl`

Read-Only:

- `status_code` (Number)
- `status_code_range` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--version--status_code_ttl--status_code_range))
- `value` (Number)

<a id="nestedobjatt--rulesets--rules--action_parameters--version--status_code_ttl--status_code_range"></a>
### Nested Schema for `rulesets.rules.action_parameters.version.status_code_ttl.value`

Read-Only:

- `from` (Number)
- `to` (Number)




<a id="nestedobjatt--rulesets--rules--action_parameters--from_list"></a>
### Nested Schema for `rulesets.rules.action_parameters.version`

Read-Only:

- `key` (String)
- `name` (String)


<a id="nestedobjatt--rulesets--rules--action_parameters--from_value"></a>
### Nested Schema for `rulesets.rules.action_parameters.version`

Read-Only:

- `preserve_query_string` (Boolean)
- `status_code` (Number)
- `target_url` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--version--target_url))

<a id="nestedobjatt--rulesets--rules--action_parameters--version--target_url"></a>
### Nested Schema for `rulesets.rules.action_parameters.version.target_url`

Read-Only:

- `expression` (String)
- `value` (String)



<a id="nestedobjatt--rulesets--rules--action_parameters--headers"></a>
### Nested Schema for `rulesets.rules.action_parameters.version`

Read-Only:

- `expression` (String)
- `name` (String)
- `operation` (String)
- `value` (String)


<a id="nestedobjatt--rulesets--rules--action_parameters--matched_data"></a>
### Nested Schema for `rulesets.rules.action_parameters.version`

Read-Only:

- `public_key` (String)


<a id="nestedobjatt--rulesets--rules--action_parameters--origin"></a>
### Nested Schema for `rulesets.rules.action_parameters.version`

Read-Only:

- `host` (String)
- `port` (Number)


<a id="nestedobjatt--rulesets--rules--action_parameters--overrides"></a>
### Nested Schema for `rulesets.rules.action_parameters.version`

Read-Only:

- `action` (String)
- `categories` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--version--categories))
- `enabled` (Boolean)
- `rules` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--version--rules))
- `sensitivity_level` (String)
- `status` (String)

<a id="nestedobjatt--rulesets--rules--action_parameters--version--categories"></a>
### Nested Schema for `rulesets.rules.action_parameters.version.categories`

Read-Only:

- `action` (String)
- `category` (String)
- `enabled` (Boolean)
- `status` (String)


<a id="nestedobjatt--rulesets--rules--action_parameters--version--rules"></a>
### Nested Schema for `rulesets.rules.action_parameters.version.rules`

Read-Only:

- `action` (String)
- `enabled` (Boolean)
- `id` (String)
- `score_threshold` (Number)
- `sensitivity_level` (String)
- `status` (String)



<a id="nestedobjatt--rulesets--rules--action_parameters--response"></a>
### Nested Schema for `rulesets.rules.action_parameters.version`

Read-Only:

- `content` (String)
- `content_type` (String)
- `status_code` (Number)


<a id="nestedobjatt--rulesets--rules--action_parameters--serve_stale"></a>
### Nested Schema for `rulesets.rules.action_parameters.version`

Read-Only:

- `disable_stale_while_updating` (Boolean)


<a id="nestedobjatt--rulesets--rules--action_parameters--sni"></a>
### Nested Schema for `rulesets.rules.action_parameters.version`

Read-Only:

- `value` (String)


<a id="nestedobjatt--rulesets--rules--action_parameters--uri"></a>
### Nested Schema for `rulesets.rules.action_parameters.version`

Read-Only:

- `origin` (Boolean)
- `path` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--version--path))
- `query` (List of Object) (see [below for nested schema](#nestedobjatt--rulesets--rules--action_parameters--version--query))

<a id="nestedobjatt--rulesets--rules--action_parameters--version--path"></a>
### Nested Schema for `rulesets.rules.action_parameters.version.path`

Read-Only:

- `expression` (String)
- `value` (String)


<a id="nestedobjatt--rulesets--rules--action_parameters--version--query"></a>
### Nested Schema for `rulesets.rules.action_parameters.version.query`

Read-Only:

- `expression` (String)
- `value` (String)




<a id="nestedobjatt--rulesets--rules--exposed_credential_check"></a>
### Nested Schema for `rulesets.rules.exposed_credential_check`

Read-Only:

- `password_expression` (String)
- `username_expression` (String)


<a id="nestedobjatt--rulesets--rules--logging"></a>
### Nested Schema for `rulesets.rules.logging`

Read-Only:

- `enabled` (Boolean)
- `status` (String)


<a id="nestedobjatt--rulesets--rules--ratelimit"></a>
### Nested Schema for `rulesets.rules.ratelimit`

Read-Only:

- `characteristics` (Set of String)
- `counting_expression` (String)
- `mitigation_timeout` (Number)
- `period` (Number)
- `requests_per_period` (Number)
- `requests_to_origin` (Boolean)
- `score_per_period` (Number)
- `score_response_header_name` (String)


